package com.hellowx.qydcdev.exception;

/**
 * Created on 2022/1/5.
 *
 * @author Hello WX
 */
public class CustomException extends RuntimeException{

    /**
     * 状态码
     */
    private int code;

    /**
     * 错误信息
     */
    private String message;

    private CustomException(){};

    public CustomException(CustomExceptionType customExceptionType){
        super(customExceptionType.getMessage());
        this.code = customExceptionType.getCode();
        this.message = customExceptionType.getMessage();
    }

    public CustomException(CustomExceptionType customExceptionType,String message){
        super(message);
        this.code = customExceptionType.getCode();
        this.message = message;
    }

    @Override
    public String getMessage() {
        return super.getMessage();
    }

    public int getCode() {
        return code;
    }
}
